package com.dfrz.utils;

/**
 * Create by keyan on 2021/7/29 17:43
 */
public class ResuleUtiles {
    public static Result success(Object obj,Integer count ){
        Result result =new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(obj);
        result.setCount(count);
        return  result;
    }

    public static Result unKnowError(Object obj){
        Result result =new Result();
        result.setCode(ResultEnum.UNKNOWN_ERROR.getCode());
        result.setMsg(ResultEnum.UNKNOWN_ERROR.getMsg());
        result.setData(obj);
        result.setCount(0);
        return  result;
    }

    public static Result userNotExist(Object obj){
        Result result =new Result();
        result.setCode(ResultEnum.USER_NOT_EXIST.getCode());
        result.setMsg(ResultEnum.USER_NOT_EXIST.getMsg());
        result.setData(obj);
        result.setCount(0);
        return  result;
    }
    public static Result userNotExists(Object obj){
        Result result =new Result();
        result.setCode(ResultEnum.USER_IS_EXISTS.getCode());
        result.setMsg(ResultEnum.USER_IS_EXISTS.getMsg());
        result.setData(obj);
        result.setCount(0);
        return  result;
    }
    public static Result dataIsNull(Object obj){
        Result result =new Result();
        result.setCode(ResultEnum.DATA_IS_NULL.getCode());
        result.setMsg(ResultEnum.DATA_IS_NULL.getMsg());
        result.setData(obj);
        result.setCount(0);
        return  result;
    }
    public static Result loginFailed(Object obj){
        Result result =new Result();
        result.setCode(ResultEnum.LOGIN_FAILED.getCode());
        result.setMsg(ResultEnum.LOGIN_FAILED.getMsg());
        result.setData(obj);
        result.setCount(0);
        return  result;
    }

}
